package com.yhb.channel.impl.Scalable;

import com.fasterxml.jackson.annotation.JsonSetter;
import com.yhb.channel.model.BankCard;
import com.yhb.channel.model.IBankCard;
import com.yhb.channel.utils.ChannelJSONUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ScalableBindCardPayload {
        private String userId;
        private IBankCard card;
        private String clientIP;
        private String channelCode;
        private String token;

        @JsonSetter("payCard")
        public void setCard(HashMap cardMap) {
                this.card = ChannelJSONUtil.parseJson(cardMap, BankCard.class);
        }
}